class Solution {
public:
    ListNode* swapPairs(ListNode* head) {
        if(head==nullptr||head->next==nullptr)return head;
        ListNode*Next=head->next;
        head->next=swapPairs(Next->next);
        Next->next=head;
        return Next;
    }
};
class Solution {
public:
    ListNode* sortList(ListNode* head) {
       vector<int>v;
       ListNode*cur=head;
    while(cur)
    {
        v.push_back(cur->val);
        cur=cur->next;
     }
     sort(v.begin(),v.end());
     cur=head;
     int i=0;
     while(cur)
     {
        
        cur->val=v[i++];
        cur=cur->next;
     }
     return head;
    }
};
